<?php 
/*
Template Name: Upload Image .php
*/
?>
<?php
// chưa up load anh len đươc thu mục

include_once($_SERVER['DOCUMENT_ROOT'].'/TTNaNoNangLuong/wp-load.php' );

$base_url= get_bloginfo('template_directory');

$uploads_dir = $base_url.'/upload_may';

var_dump($_FILES["images"]["error"]);die();


foreach ($_FILES["images"]["error"] as $key => $error) 
{
    if ($error == UPLOAD_ERR_OK) {
    	$tmp_name = $_FILES["images"]["tmp_name"][$key];
        $name = $_FILES["images"]["name"][$key];
        //move_uploaded_file( $_FILES["images"]["tmp_name"][$key], $base_url."/upload_may/" . $_FILES['images']['name'][$key]);
        move_uploaded_file($tmp_name, "$uploads_dir/$name");
    }
}

/*
$uploads_dir = '/uploads';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
        $name = $_FILES["pictures"]["name"][$key];
        move_uploaded_file($tmp_name, "$uploads_dir/$name");
    }
}
*/


echo "<h2>Successfully Uploaded Images</h2>";

//<img src="<?php echo get_bloginfo('template_directory').'/upload_may/